﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using whatpricemyhouse.LINQ;

namespace whatpricemyhouse.agent
{
    public class AdminBasicPage : System.Web.UI.Page
    {
        public AdminBasicPage() {
            if (Page.User.Identity.IsAuthenticated) {
                MembershipUser user = Membership.GetUser();
                Guid agentId = new Guid(user.ProviderUserKey.ToString());
                if (user != null) {
                    DataControllerDataContext dcdc = new DataControllerDataContext();
                    var places = from p in dcdc.place_agent_tables
                                 where p.UserID == agentId
                                 select p;

                    foreach (var place in places) {
                        Session["areaName"] = place.suburb.area;
                    }
                }
            }
        }
    }
}